//
//  NSString+Extension.m
//  微博项目
//
//  Created by qianfeng on 15/6/2.
//  Copyright (c) 2015年 Ye sichao. All rights reserved.
//

#import "NSString+Extension.h"

@implementation NSString (Extension)
+ (CGSize)sizeWithText:(NSString *)text font:(UIFont *)font maxSize:(CGSize)maxSize {
    NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
    attrs[NSFontAttributeName] = font;
    return [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
}

+ (CGSize)sizeWithText:(NSString *)text font:(UIFont *)font {
    return [self sizeWithText:text font:font maxSize:CGSizeMake(MAXFLOAT, MAXFLOAT)];
}
@end
